require('../../assets/css/index.less')
require('./mymine.less')
require('../../lib/swiper/swiper-bundle.min.css')
// require('../../lib/swiper/swiper-bundle.min')
import Swiper from '../../lib/swiper/swiper-bundle.min'; 
const API = 'http://fitness.h5.itsource.cn:3701'

function $(arr) {
  return document.querySelector(arr)
}

const  request= require('../../utils/request')


const renderTabbar = require('../../utils/tabbar')
window.onload = () => {
  $('.yonghuming').addEventListener('click',function(){
    location.href='./user-datali.html'
  })
  $('.daka1').addEventListener('click',function(){
    console.log(1);

function getuser(){
  //调接口
  request.get('/api/exercise').then(res=>{
    //解构
    let {errno,data}=res.data
    if(errno===0){
      //渲染
      render(data)
    }
    console.log(res);
  })
}
getuser()

function render(data){
  $('.fenzhong').textContent=data.sum7Meter
  // $('.daka_span1').textContent=data.clockCount
  $('.qianka').textContent=data.sum7Calorie
}





})  

$('.daka1').addEventListener('click',function(){
  function getuser(){
    //调用接口
    request.get('/api/user/info').then(res=>{
      //解构
      let {errno,data}=res.data
      if(errno===0){
        //渲染

        render(data)
      }
      console.log(res);
    })
  }
  getuser()
  function render(data){
    $('.daka_span1').textContent=data.clockCount
    // $('.daka_span1').textContent=data.clockCount
    // $('.qianka').textContent=data.sum7Calorie
    $('.yhmspan').textContent=data.sign
    $('#avatar').src=API + data.imgUrl
  }
  
})









//渲染tabbar
  renderTabbar()
}







//轮播图 
 var mySwiper = new Swiper ('.swiper', {
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
  loop: true, // 循环模式选项
  autoplay: {
      delay: 2500,
      disableOnInteraction: false,
    },//自动翻页
  
  // 如果需要分页器
  pagination: {
      el: ".swiper-pagination",
    },
  
})  
$('.shuju').addEventListener('click',()=>{
  location.href='./sports-data.html'
})







